/**
 * Captain
 * © 2017 Captain copyright，All rights reserved.
 * http://www.sccaptain.com.cn
 * <p>
 * JAVA : 8
 * 文  件  名: UUIDGenerator.java
 * 创  建  人: liujian (liu.jian@sccaptain.com.cn)
 * 创建时间: 2017/6/29 11:24
 * 版         本: 1.0.0
 * 备         注:
 * 修订历史:
 */

package com.material.c2c.core;

import com.fasterxml.uuid.EthernetAddress;
import com.fasterxml.uuid.Generators;
import com.fasterxml.uuid.impl.TimeBasedGenerator;

import java.util.UUID;

/**
 * TimeBased UUID 生成类
 *
 * @since 1.0
 * @version 1.0
 * @author liujian (liu.jian@sccaptain.com.cn)
 */
public class UUIDGenerator {

  private static final TimeBasedGenerator gen = Generators.timeBasedGenerator(EthernetAddress.fromInterface());

  /**
   * 生成 TimeBased UUID
   * @return TimeBased UUID
   *
   * @since 1.0
   * @version 1.0
   * @author liujian (liu.jian@sccaptain.com.cn)
   */
  public static UUID generate(){
    return gen.generate();
  }

  /**
   * 生成 TimeBased UUID 字符串
   * @return TimeBased UUID 字符串
   *
   * @since 1.0
   * @version 1.0
   * @author liujian (liu.jian@sccaptain.com.cn)
   */
  public static String generateUUIDStr(){
    return UUIDGenerator.generate().toString();
  }

}
